package com.mondo.financialwallet.presentation.model;


import java.io.Serializable;
import java.text.DecimalFormat;

public class Token implements Serializable {

    private String id;

    private String name;

    private String chineseName;

    private String usd;

    private String cny;

    private String address;

    private double gas;

    private String cover;

    public double getGas() {
        return gas;
    }

    public Token(String cover, int id, String name, String usd, String cny) {
        this.name = name;
        this.cover = cover;
        this.usd = usd;
        this.cny = cny;
        this.id = String.valueOf(id);
    }

    public Token(String cover,int id, double gas,String name, String usd, String cny) {
        this.name = name;
        this.cover = cover;
        this.usd = usd;
        this.cny = cny;
        this.id = String.valueOf(id);
        this.gas = gas;
    }

    public Token(int id, String name, String chineseName, String usd, String cny) {
        this.id = String.valueOf(id);
        this.name = name;
        this.chineseName = chineseName;
        this.usd = usd;
        this.cny = cny;
    }

    public Token(String cover, int id, double gas, String name, String chineseName, String usd, String cny) {
        this.id = String.valueOf(id);
        this.cover = cover;
        this.name = name;
        this.gas = gas;
        this.chineseName = chineseName;
        this.usd = usd;
        this.cny = cny;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getId() {
        return id;
    }

    public String getAddress() {
        return address;
    }

    public String getName() {
        return name;
    }

    public String getChineseName() {
        return chineseName;
    }

    public String getUsd() {
        if (usd == null){
            return "0";
        }

        return "≈$ " + new DecimalFormat("########.#######")
                .format(Double.parseDouble(usd));
    }

    public String getCny() {
        if (cny == null){
            return "0";
        }


        return new DecimalFormat("########.#######")
                .format(Double.parseDouble(cny));
    }

    public String getCover() {
        return cover;
    }
}
